package Demo07;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Random;

public class Demo02ArrayListReturn {
    public static void main(String[] args) {
        Random r = new Random();
        ArrayList<Integer> bigList = new ArrayList<>();
        for (int i = 0; i <20 ; i++) {
            int num = r.nextInt(100);
            bigList.add(num);
            }
        ArrayList<Integer> smallList = getSmallList(bigList);
        for (int i = 0; i < smallList.size() ; i++) {
            System.out.println(smallList.get(i));
        }
        }

    public static ArrayList<Integer> getSmallList(ArrayList<Integer> bigList){
        ArrayList<Integer> smallList = new ArrayList<>();
        for (int i = 0; i <bigList.size() ; i++) {
            int num = bigList.get(i);
            if(num%2 == 0){
               smallList.add(num);

        }

    }
        return smallList;
    }
}
